Skip to content

Fix ASAN initialization-order-fiasco issue in tensor_layout_print.mlir test#8117

Merged
ThomasRaoux merged 1 commit into
triton-lang:mainfrom
openxla:export_cl804850630
Sep 9, 2025
Merged

Fix ASAN initialization-order-fiasco issue in tensor_layout_print.mlir test#8117
ThomasRaoux merged 1 commit into
triton-lang:mainfrom
openxla:export_cl804850630

Conversation

@gflegar
Copy link
Copy Markdown
Collaborator

@gflegar gflegar commented Sep 9, 2025

IIUC, the initialization order between static and non-static variables is not guaranteed, so we can't use the previous non-static variable to initialize a static one later on. Working around that by moving it into a static function variable.

We discovered this when upgrading to a newer LLVM version, so it might only be reproducible with new LLVM.

Here is the error:

==3551==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x557bc517caa0 at pc 0x557bc3f2fbb2 bp 0x7ffda74ef270 sp 0x7ffda74ef268

READ of size 8 at 0x557bc517caa0 thread T0

    #0 0x557bc3f2fbb1 in getName llvm/include/llvm/Support/CommandLine.h:194:38

    #1 0x557bc3f2fbb1 in operator() llvm/lib/Support/CommandLine.cpp:347:5

    #2 0x557bc3f2fbb1 in __invoke<(lambda at llvm/lib/Support/CommandLine.cpp:347:5) &, llvm::cl::OptionCategory *> libcxx/include/__type_traits/invoke.h:87:27

    #3 0x557bc3f2fbb1 in __count_if<std::__u::_ClassicAlgPolicy, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, std::__u::__identity, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:30:9

    #4 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:41:10

    #5 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSet<llvm::cl::OptionCategory *, 16U> &, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> llvm/include/llvm/ADT/STLExtras.h:1981:10

    #6 0x557bc3f2fbb1 in registerCategory llvm/lib/Support/CommandLine.cpp:347:5

    #7 0x557bc3f2fbb1 in llvm::cl::OptionCategory::registerCategory() llvm/lib/Support/CommandLine.cpp:484:17

    #8 0x557bc4504950 in OptionCategory llvm/include/llvm/Support/CommandLine.h:191:5

    #9 0x557bc4504950 in __cxx_global_var_init llvm/lib/CodeGen/GlobalISel/Combiner.cpp:37:20

…mlir` test

IIUC, the initialization order between static and non-static variables is not guaranteed, so we can't use the previous non-static variable to initialize a static one later on. Working around that by moving it into a static function member.

We discovered this when upgrading to a newer LLVM version, so it might only be reproducible with new LLVM.

Here is the error:

```
==3551==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x557bc517caa0 at pc 0x557bc3f2fbb2 bp 0x7ffda74ef270 sp 0x7ffda74ef268

READ of size 8 at 0x557bc517caa0 thread T0

    #0 0x557bc3f2fbb1 in getName llvm/include/llvm/Support/CommandLine.h:194:38

    #1 0x557bc3f2fbb1 in operator() llvm/lib/Support/CommandLine.cpp:347:5

    #2 0x557bc3f2fbb1 in __invoke<(lambda at llvm/lib/Support/CommandLine.cpp:347:5) &, llvm::cl::OptionCategory *> libcxx/include/__type_traits/invoke.h:87:27

    #3 0x557bc3f2fbb1 in __count_if<std::__u::_ClassicAlgPolicy, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, std::__u::__identity, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:30:9

    #4 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:41:10

    #5 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSet<llvm::cl::OptionCategory *, 16U> &, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> llvm/include/llvm/ADT/STLExtras.h:1981:10

    #6 0x557bc3f2fbb1 in registerCategory llvm/lib/Support/CommandLine.cpp:347:5

    #7 0x557bc3f2fbb1 in llvm::cl::OptionCategory::registerCategory() llvm/lib/Support/CommandLine.cpp:484:17

    #8 0x557bc4504950 in OptionCategory llvm/include/llvm/Support/CommandLine.h:191:5

    #9 0x557bc4504950 in __cxx_global_var_init llvm/lib/CodeGen/GlobalISel/Combiner.cpp:37:20
```
@gflegar gflegar requested a review from ptillet as a code owner September 9, 2025 11:50
@ThomasRaoux ThomasRaoux enabled auto-merge (squash) September 9, 2025 18:03
@ThomasRaoux ThomasRaoux disabled auto-merge September 9, 2025 18:03
@ThomasRaoux ThomasRaoux merged commit 4f5f43e into triton-lang:main Sep 9, 2025
7 of 9 checks passed
@gflegar gflegar deleted the export_cl804850630 branch September 11, 2025 08:00
agron911 added a commit to agron911/triton that referenced this pull request Feb 10, 2026
…issue in `tensor_layout_print.mlir` test (#8117)'

Summary:
This is a cherry-pick of an upstream PR: triton-lang/triton#8117

Upstream commit message:
```
> Fix ASAN `initialization-order-fiasco` issue in `tensor_layout_print.mlir` test (#8117)

> IIUC, the initialization order between static and non-static variables
> is not guaranteed, so we can't use the previous non-static variable to
> initialize a static one later on. Working around that by moving it into
> a static function variable.

> We discovered this when upgrading to a newer LLVM version, so it might
> only be reproducible with new LLVM.

> Here is the error:

> ```
> ==3551==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x557bc517caa0 at pc 0x557bc3f2fbb2 bp 0x7ffda74ef270 sp 0x7ffda74ef268

> READ of size 8 at 0x557bc517caa0 thread T0

>     #0 0x557bc3f2fbb1 in getName llvm/include/llvm/Support/CommandLine.h:194:38

>     #1 0x557bc3f2fbb1 in operator() llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#2 0x557bc3f2fbb1 in __invoke<(lambda at llvm/lib/Support/CommandLine.cpp:347:5) &, llvm::cl::OptionCategory *> libcxx/include/__type_traits/invoke.h:87:27

>     facebookexperimental#3 0x557bc3f2fbb1 in __count_if<std::__u::_ClassicAlgPolicy, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, std::__u::__identity, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:30:9

>     facebookexperimental#4 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:41:10

>     facebookexperimental#5 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSet<llvm::cl::OptionCategory *, 16U> &, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> llvm/include/llvm/ADT/STLExtras.h:1981:10

>     facebookexperimental#6 0x557bc3f2fbb1 in registerCategory llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#7 0x557bc3f2fbb1 in llvm::cl::OptionCategory::registerCategory() llvm/lib/Support/CommandLine.cpp:484:17

>     facebookexperimental#8 0x557bc4504950 in OptionCategory llvm/include/llvm/Support/CommandLine.h:191:5

>     facebookexperimental#9 0x557bc4504950 in __cxx_global_var_init llvm/lib/CodeGen/GlobalISel/Combiner.cpp:37:20
> ```
```

***Do not remove the following line from this commit***
Reactor Cherry-pick Revision: 4f5f43e
---

This diff was generated by running:
```
buck run fbcode//triton/tools/reactor:reactor -- cherrypick --num-commits 3
```

Differential Revision: D92893421
agron911 added a commit to agron911/triton that referenced this pull request Feb 11, 2026
…issue in `tensor_layout_print.mlir` test (#8117)' (facebookexperimental#883)

Summary:

This is a cherry-pick of an upstream PR: triton-lang/triton#8117

Upstream commit message:
```
> Fix ASAN `initialization-order-fiasco` issue in `tensor_layout_print.mlir` test (#8117)

> IIUC, the initialization order between static and non-static variables
> is not guaranteed, so we can't use the previous non-static variable to
> initialize a static one later on. Working around that by moving it into
> a static function variable.

> We discovered this when upgrading to a newer LLVM version, so it might
> only be reproducible with new LLVM.

> Here is the error:

> ```
> ==3551==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x557bc517caa0 at pc 0x557bc3f2fbb2 bp 0x7ffda74ef270 sp 0x7ffda74ef268

> READ of size 8 at 0x557bc517caa0 thread T0

>     #0 0x557bc3f2fbb1 in getName llvm/include/llvm/Support/CommandLine.h:194:38

>     #1 0x557bc3f2fbb1 in operator() llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#2 0x557bc3f2fbb1 in __invoke<(lambda at llvm/lib/Support/CommandLine.cpp:347:5) &, llvm::cl::OptionCategory *> libcxx/include/__type_traits/invoke.h:87:27

>     facebookexperimental#3 0x557bc3f2fbb1 in __count_if<std::__u::_ClassicAlgPolicy, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, std::__u::__identity, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:30:9

>     facebookexperimental#4 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:41:10

>     facebookexperimental#5 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSet<llvm::cl::OptionCategory *, 16U> &, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> llvm/include/llvm/ADT/STLExtras.h:1981:10

>     facebookexperimental#6 0x557bc3f2fbb1 in registerCategory llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#7 0x557bc3f2fbb1 in llvm::cl::OptionCategory::registerCategory() llvm/lib/Support/CommandLine.cpp:484:17

>     facebookexperimental#8 0x557bc4504950 in OptionCategory llvm/include/llvm/Support/CommandLine.h:191:5

>     facebookexperimental#9 0x557bc4504950 in __cxx_global_var_init llvm/lib/CodeGen/GlobalISel/Combiner.cpp:37:20
> ```
```

***Do not remove the following line from this commit***
Reactor Cherry-pick Revision: 4f5f43e
---

This diff was generated by running:
```
buck run fbcode//triton/tools/reactor:reactor -- cherrypick --num-commits 3
```

Reviewed By: stashuk-olek

Differential Revision: D92893421
agron911 added a commit to agron911/triton that referenced this pull request Feb 11, 2026
…issue in `tensor_layout_print.mlir` test (#8117)' (facebookexperimental#883)

Summary:

This is a cherry-pick of an upstream PR: triton-lang/triton#8117

Upstream commit message:
```
> Fix ASAN `initialization-order-fiasco` issue in `tensor_layout_print.mlir` test (#8117)

> IIUC, the initialization order between static and non-static variables
> is not guaranteed, so we can't use the previous non-static variable to
> initialize a static one later on. Working around that by moving it into
> a static function variable.

> We discovered this when upgrading to a newer LLVM version, so it might
> only be reproducible with new LLVM.

> Here is the error:

> ```
> ==3551==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x557bc517caa0 at pc 0x557bc3f2fbb2 bp 0x7ffda74ef270 sp 0x7ffda74ef268

> READ of size 8 at 0x557bc517caa0 thread T0

>     #0 0x557bc3f2fbb1 in getName llvm/include/llvm/Support/CommandLine.h:194:38

>     #1 0x557bc3f2fbb1 in operator() llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#2 0x557bc3f2fbb1 in __invoke<(lambda at llvm/lib/Support/CommandLine.cpp:347:5) &, llvm::cl::OptionCategory *> libcxx/include/__type_traits/invoke.h:87:27

>     facebookexperimental#3 0x557bc3f2fbb1 in __count_if<std::__u::_ClassicAlgPolicy, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, std::__u::__identity, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:30:9

>     facebookexperimental#4 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:41:10

>     facebookexperimental#5 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSet<llvm::cl::OptionCategory *, 16U> &, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> llvm/include/llvm/ADT/STLExtras.h:1981:10

>     facebookexperimental#6 0x557bc3f2fbb1 in registerCategory llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#7 0x557bc3f2fbb1 in llvm::cl::OptionCategory::registerCategory() llvm/lib/Support/CommandLine.cpp:484:17

>     facebookexperimental#8 0x557bc4504950 in OptionCategory llvm/include/llvm/Support/CommandLine.h:191:5

>     facebookexperimental#9 0x557bc4504950 in __cxx_global_var_init llvm/lib/CodeGen/GlobalISel/Combiner.cpp:37:20
> ```
```

***Do not remove the following line from this commit***
Reactor Cherry-pick Revision: 4f5f43e
---

This diff was generated by running:
```
buck run fbcode//triton/tools/reactor:reactor -- cherrypick --num-commits 3
```

Reviewed By: stashuk-olek

Differential Revision: D92893421
agron911 added a commit to agron911/triton that referenced this pull request Feb 11, 2026
…issue in `tensor_layout_print.mlir` test (#8117)' (facebookexperimental#883)

Summary:

This is a cherry-pick of an upstream PR: triton-lang/triton#8117

Upstream commit message:
```
> Fix ASAN `initialization-order-fiasco` issue in `tensor_layout_print.mlir` test (#8117)

> IIUC, the initialization order between static and non-static variables
> is not guaranteed, so we can't use the previous non-static variable to
> initialize a static one later on. Working around that by moving it into
> a static function variable.

> We discovered this when upgrading to a newer LLVM version, so it might
> only be reproducible with new LLVM.

> Here is the error:

> ```
> ==3551==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x557bc517caa0 at pc 0x557bc3f2fbb2 bp 0x7ffda74ef270 sp 0x7ffda74ef268

> READ of size 8 at 0x557bc517caa0 thread T0

>     #0 0x557bc3f2fbb1 in getName llvm/include/llvm/Support/CommandLine.h:194:38

>     #1 0x557bc3f2fbb1 in operator() llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#2 0x557bc3f2fbb1 in __invoke<(lambda at llvm/lib/Support/CommandLine.cpp:347:5) &, llvm::cl::OptionCategory *> libcxx/include/__type_traits/invoke.h:87:27

>     facebookexperimental#3 0x557bc3f2fbb1 in __count_if<std::__u::_ClassicAlgPolicy, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, std::__u::__identity, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:30:9

>     facebookexperimental#4 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:41:10

>     facebookexperimental#5 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSet<llvm::cl::OptionCategory *, 16U> &, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> llvm/include/llvm/ADT/STLExtras.h:1981:10

>     facebookexperimental#6 0x557bc3f2fbb1 in registerCategory llvm/lib/Support/CommandLine.cpp:347:5

>     facebookexperimental#7 0x557bc3f2fbb1 in llvm::cl::OptionCategory::registerCategory() llvm/lib/Support/CommandLine.cpp:484:17

>     facebookexperimental#8 0x557bc4504950 in OptionCategory llvm/include/llvm/Support/CommandLine.h:191:5

>     facebookexperimental#9 0x557bc4504950 in __cxx_global_var_init llvm/lib/CodeGen/GlobalISel/Combiner.cpp:37:20
> ```
```

***Do not remove the following line from this commit***
Reactor Cherry-pick Revision: 4f5f43e
---

This diff was generated by running:
```
buck run fbcode//triton/tools/reactor:reactor -- cherrypick --num-commits 3
```

Reviewed By: stashuk-olek

Differential Revision: D92893421
meta-codesync Bot pushed a commit to facebookexperimental/triton that referenced this pull request Feb 11, 2026
…issue in `tensor_layout_print.mlir` test (#8117)' (#883)

Summary:
Pull Request resolved: #883

This is a cherry-pick of an upstream PR: triton-lang/triton#8117

Upstream commit message:
```
> Fix ASAN `initialization-order-fiasco` issue in `tensor_layout_print.mlir` test (#8117)

> IIUC, the initialization order between static and non-static variables
> is not guaranteed, so we can't use the previous non-static variable to
> initialize a static one later on. Working around that by moving it into
> a static function variable.

> We discovered this when upgrading to a newer LLVM version, so it might
> only be reproducible with new LLVM.

> Here is the error:

> ```
> ==3551==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x557bc517caa0 at pc 0x557bc3f2fbb2 bp 0x7ffda74ef270 sp 0x7ffda74ef268

> READ of size 8 at 0x557bc517caa0 thread T0

>     #0 0x557bc3f2fbb1 in getName llvm/include/llvm/Support/CommandLine.h:194:38

>     #1 0x557bc3f2fbb1 in operator() llvm/lib/Support/CommandLine.cpp:347:5

>     #2 0x557bc3f2fbb1 in __invoke<(lambda at llvm/lib/Support/CommandLine.cpp:347:5) &, llvm::cl::OptionCategory *> libcxx/include/__type_traits/invoke.h:87:27

>     #3 0x557bc3f2fbb1 in __count_if<std::__u::_ClassicAlgPolicy, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, std::__u::__identity, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:30:9

>     #4 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSetIterator<llvm::cl::OptionCategory *>, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> libcxx/include/__algorithm/count_if.h:41:10

>     #5 0x557bc3f2fbb1 in count_if<llvm::SmallPtrSet<llvm::cl::OptionCategory *, 16U> &, (lambda at llvm/lib/Support/CommandLine.cpp:347:5)> llvm/include/llvm/ADT/STLExtras.h:1981:10

>     #6 0x557bc3f2fbb1 in registerCategory llvm/lib/Support/CommandLine.cpp:347:5

>     #7 0x557bc3f2fbb1 in llvm::cl::OptionCategory::registerCategory() llvm/lib/Support/CommandLine.cpp:484:17

>     #8 0x557bc4504950 in OptionCategory llvm/include/llvm/Support/CommandLine.h:191:5

>     #9 0x557bc4504950 in __cxx_global_var_init llvm/lib/CodeGen/GlobalISel/Combiner.cpp:37:20
> ```
```

***Do not remove the following line from this commit***
Reactor Cherry-pick Revision: 4f5f43e
 ---

This diff was generated by running:
```
buck run fbcode//triton/tools/reactor:reactor -- cherrypick --num-commits 3
```

Reviewed By: stashuk-olek

Differential Revision: D92893421

fbshipit-source-id: 4d4bfcf7459e4ff08a3a06a4292e656df3249675
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants